import java.io.*;

public class Test4 {
    public static void main(String[] args) throws IOException {
        String fileName = "D:\\Java\\Hello.txt";

        BufferedWriter out = new BufferedWriter(new FileWriter(fileName, true));//out为向文件中写内容

        out.write("Hello!");
        out.newLine();
        out.write("This is another text file using BufferedWriter,");
        out.newLine();
        out.write("****************");
        out.newLine();
        out.close();
    }
}
